using UnityEngine;
using UnityEngine.UIElements;

public class FirstUIController : MonoBehaviour
{
    private Button myButton;
    private Label myLabel;
    
    void OnEnable()
    {
        var root = GetComponent<UIDocument>().rootVisualElement;
        
        myButton = root.Q<Button>("my-button");
        myLabel = root.Q<Label>("my-label");
        
        myButton.clicked += () => {
            myLabel.text = "Button clicked!";
            Debug.Log(myLabel.text);
        };
    }
}